#include "ScoreSheet.h"


ScoreCell::ScoreCell()
{
    m_playerId  = 0;
    m_isCorrect  = false;
}

ScoreCell::ScoreCell(quint32 player, bool isCorrect)
{
     m_playerId  = player;
     m_isCorrect  = isCorrect;
}



ScoreSheet::ScoreSheet()
{

}


void ScoreSheet::addCell(quint32 playerId, bool isCorrect){
    m_sheet.append(ScoreCell(playerId, isCorrect));
}


int ScoreSheet::correctNumberOf(quint32 playerId) const{
    int count  = 0;
    foreach (const ScoreCell &cell, m_sheet) {
        if(cell.m_playerId == playerId  &&  cell.m_isCorrect){
            count++;
        }
    }

    return count;
}


int ScoreSheet::incorrectNumberOf(quint32 playerId) const{
    int count  = 0;
    foreach (const ScoreCell &cell, m_sheet) {
        if(cell.m_playerId == playerId  &&  cell.m_isCorrect == false){
            count++;
        }
    }

    return count;
}



void ScoreSheet::clear(){
    m_sheet.clear();
}

